package tools;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.pool.OracleDataSource;

public class koneksi {

    public static Connection bukaKoneksi() {
//        String url  = "jdbc:oracle:thin:@localhost:1521:xe";
//        String user = "hr";
//        String pwd  = "115314005";
//        
        String url  = "jdbc:oracle:thin:@localhost:1521:xe";
        String user = "hr";
        String pwd  = "renia";
        
//        String url  = "jdbc:oracle:thin:@localhost:1521:xe";
//        String user = "MHs115314078";
//        String pwd  = "mhs115314078";

//        String url  = "jdbc:oracle:thin:@localhost:1521:xe";
//        String user = "hr";
//        String pwd  = "hr";
                
        Connection conn = null;

        try {
            OracleDataSource ds = new OracleDataSource();
            ds.setURL(url);
            conn = ds.getConnection(user, pwd);
            System.out.println("Koneksi is OK");
        } catch (SQLException ex) {
            Logger.getLogger(koneksi.class.getName()).log(Level.SEVERE, null, ex);
        }
        return conn;
    }

    public static void main(String[] args) {
        koneksi.bukaKoneksi();
    }
}
